// 首页热招职位的组件
import style from "./style.module.css";
import { Link } from "react-router-dom";
import * as Enum from "../../assets/enum";
import { IFav } from "../../types";
import IconFont from "../../assets/icon";

interface Props {
  recruit: IFav;
  remove: (id: string) => void;
}
export default function FavItem(props: Props) {
  return (
    <div className={style.demoz}>
      <Link
        to={"/recruit/" + props.recruit?.items[0]._id}
        className={style.recruitItem}
      >
        <div className={style.title}>
          <span className={style.titleName}>
            {props.recruit?.items[0].positionName}
          </span>
          <span className={style.titleSalary}>
            {props.recruit?.items[0].salary.min}-
            {props.recruit?.items[0].salary.max}K
          </span>
        </div>
        <div className={style.name}>
          <span className={style.companyName}>
            {props.recruit?.items[0].time}
          </span>
          <span className={style.city}>{props.recruit?.items[0].city}</span>
        </div>
        <div className={style.keylist}>
          <span className={style.keyItem}>
            {Enum.toYear(props.recruit?.items[0].workYear)}
          </span>
          <span className={style.keyItem}>
            {Enum.toEducation(props.recruit?.items[0].education)}
          </span>
        </div>
        <div className={style.keylist}>
          {props.recruit.items[0].keyWords.slice(0, 3).map((item, index) => {
            return (
              <span className={style.keyItem} key={index}>
                {item}
              </span>
            );
          })}
        </div>
      </Link>
      <div>
        <IconFont
          className={style.icon}
          type="icon-icon--"
          onClick={() => props.remove(props.recruit._id)}
        />
      </div>
    </div>
  );
}
